<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

/**
 * @author Anh Nguyen <duyanhnguyen@vccorp.vn>
 * @copyright 2012
 */

class Search extends MX_Controller
{
    private $_langCode;

    function __construct()
    {
        parent::__construct();
        $this->load->library('DefaultLayout');
        $this->load->library('Minifier');
        $this->_langCode = $this->mycommon->getLangCode();
        $this->load->language('common', $this->_langCode);
        $this->load->model('home/home_model');
    }
    
    public function index()
    {
        $data = array();
        $keywords = $this->input->get('keyword', true);
        if($keywords == '') {
            redirect();
        }
        $langCode = $this->mycommon->fetchLangCode($this->_langCode);
        $tmpResult = $this->home_model->search($keywords, $langCode);
        $data['result'] = $tmpResult;
        $this->minifier->addCss('product/style');
        $this->defaultlayout->_loadHeader();
        $this->load->view('search/search_view', $data);
        $this->defaultlayout->_loadFooter();
    }

}

?>
